<?php
/**
 * Created by PhpStorm.
 * User: lcz
 * Date: 2018/8/18
 * Time: 11:12
 */
namespace app\index\controller;


use app\common\model\Baokim;
use think\Controller;

class Pay extends Controller {
	
	public function baokimSuccess(){
		header('Content-type:text/html; charset=utf8');
		$data = $this->request->request();
		$baokim = new Baokim();
		if(isset($data['s'])){
			unset($data['s']);
		}
		//检验数据正确性
		$res = $baokim->verifyResponseUrl($data);
		if(!$res) {
			echo '数据错误';
			die;
		}
		
		$model = new \app\common\model\Recharge();
		$no = $data['order_id'];
		$res = $model->checkRechargeRow($no, $data['transaction_id'], $data['total_amount'], 'baokim');
		if($res) {
			echo '充值成功';
		} else {
			echo $model->getError();
		}
	}
	
	public function cancel(){
		header('Content-type:text/html; charset=utf8');
		echo '您取消了支付';
	}

}
